package com.sqlcheck.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.Map;

@Data
@Schema(description = "创建扫描任务请求")
public class CreateScanTaskRequest {

    @NotBlank(message = "任务名称不能为空")
    @Schema(description = "任务名称", example = "项目A的SQL兼容性扫描", required = true, maxLength = 100)
    private String taskName;

    @NotNull(message = "任务类型不能为空")
    @Schema(description = "任务类型", example = "PROJECT_SCAN", required = true, allowableValues = { "PROJECT_SCAN",
            "GIT_SOURCE_SCAN", "DATABASE_DDL_SCAN", "MANUAL_SQL" })
    private String taskType;

    @Schema(description = "关联的项目ID，用于项目扫描任务", example = "1")
    private Long projectId;

    @Schema(description = "分支名称，用于项目扫描任务", example = "main")
    private String branchName;

    @Schema(description = "任务描述", example = "对项目A进行Oracle到GoldenDB的兼容性扫描分析")
    private String description;

    @Schema(description = "任务配置参数，JSON格式的配置信息", example = """
            {
                "sourceDbType": "ORACLE",
                "targetDbType": "GOLDENDB",
                "scanRules": ["SYNTAX_CHECK", "COMPATIBILITY_CHECK"],
                "includePatterns": ["**/*.sql", "**/*.java"],
                "excludePatterns": ["**/test/**"]
            }
            """)
    private Map<String, Object> config;

    @Schema(description = "源数据库类型", example = "ORACLE")
    private String sourceDbType;

    @Schema(description = "目标数据库类型", example = "GOLDENDB")
    private String targetDbType;

    @Schema(description = "是否启用AI增强分析", example = "false")
    private Boolean aiEnhancementEnabled = false;

    @Schema(description = "AI筛选配置", example = """
            {
                "severityThreshold": "MEDIUM",
                "maxStatements": 50,
                "timeoutSeconds": 60,
                "enableParallelProcessing": true
            }
            """)
    private Map<String, Object> aiFilterConfig;
}